package com.summer.framework.admin.mq;

import com.summer.framework.admin.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.stereotype.Component;

/**
 * @auther: 杨杰
 * @date: 2019/5/9 17:44
 * @description:
 */
@Component
@EnableBinding(StreamClient.class)
@Slf4j
public class StreamReceiver {  //消息接受类
    @Autowired
    private UserService userService;

    @StreamListener(StreamClient.INPUT)
    public void receiver(String userName) {
        log.info("getUserByName:" + userService.getUserByName(userName));

        System.out.println("接收到消息：" + userName.toString());
    }
}
